const BootApiController = require('../app/controllers/bootapi')
const Util = require('../lib/utils')
class Test{
    constructor() {
        this.serialize()
        this.buildcache()
    }
    async serialize () {
        while (true) {
            let res = await BootApiController.serialize()
            if (!res) {
                console.log('序列化完成等待10分钟...')
                await Util.wait(10 * 60 * 1000)// 10分钟
            }
        }
    }
    async buildcache () {
        while (true) {
            let res = await BootApiController.buildcache()
            if (!res) {
                console.log('缓存完成等待5分钟...')
                await Util.wait(60 * 5 * 1000) // 5分钟
            }
        }
    }
}

module.exports = new Test()